/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Polimorfismo;

/**
 *
 * @author c0220909
 */
public class Principal {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Animal a = new Animal();
        Animal b = new Horse(); //Animal ref, but a Horse object
        a.eat(); // Runs the Animal version of eat()
        b.eat(); // Runs the Horse version of eat()
        // c.buck(); // Can't invoke buck();

        //Overloaded
        Adder e = new Adder();
        int d = 27;
        int c = 3;
        int result = e.addThem(d, c); // Which addThem is invoked?
        double doubleResult = e.addThem(22.5, 9.3); // Which addThem?

        AnimalA ani = new AnimalA();
        HorseA hor = new HorseA();
        ani.eat();
        hor.eat();
        
        AnimalA ah = new HorseA();
        ah.eat();

        HorseA he = new HorseA();
        he.eat("Apples");
        //Compiler error!
       // AnimalA a2 = new AnimalA();
       // a2.eat("treats");
        //Compiler error!
       // AnimalA ah2 = new HorseA();
       // ah2.eat("Carrots");
    }
}
